﻿using System;

namespace Caramel.NHibernate.Membership.Entities
{
	public class aspnet_Membership
	{
		//public virtual Guid ApplicationId { get; set; }

		//public virtual Guid UserId { get; set; }

		public virtual string Password { get; set; }

		public virtual int PasswordFormat { get; set; }

		public virtual string PasswordSalt { get; set; }

		public virtual string MobilePIN { get; set; }

		public virtual string Email { get; set; }

		public virtual string LoweredEmail { get; set; }

		public virtual string PasswordQuestion { get; set; }

		public virtual string PasswordAnswer { get; set; }

		public virtual bool IsApproved { get; set; }

		public virtual bool IsLockedOut { get; set; }

		public virtual DateTime CreateDate { get; set; }

		public virtual DateTime LastLoginDate { get; set; }

		public virtual DateTime LastPasswordChangedDate { get; set; }

		public virtual DateTime LastLockoutDate { get; set; }

		public virtual int FailedPasswordAttemptCount { get; set; }

		public virtual DateTime FailedPasswordAttemptWindowStart { get; set; }

		public virtual int FailedPasswordAnswerAttemptCount { get; set; }

		public virtual DateTime FailedPasswordAnswerAttemptWindowStart { get; set; }

		public virtual string Comment { get; set; }

		public virtual aspnet_Applications Application { get; set; }

		public virtual aspnet_Users User { get; set; }

		public override bool Equals(object obj)
		{
			if (obj == null)
			{
				return false;
			}

			var membership = obj as aspnet_Membership;

			if ((membership != null) && (membership.Application != null) && (membership.User != null) && (this.Application != null) && (this.User != null))
			{
				return
					(membership.Application.ID == this.Application.ID) &&
					(membership.User.ID == this.User.ID);
			}

			return false;
		}

		public override int GetHashCode()
		{
			return
				this.Application.ID.GetHashCode() ^
				this.User.ID.GetHashCode();
		}
	}
}
